package com.company.behavioral.interparter_pattern.nonterminal_expression;

import com.company.behavioral.interparter_pattern.abstract_expression.AbstractNode;

/**
 * 简单句子节点
 * @ClassName SentenceNode
 * @Author tiezheng.han
 * @Date 2020/9/4 10:37
 **/
public class SentenceNode extends AbstractNode {

    private AbstractNode direction;

    private AbstractNode action;

    private AbstractNode distance;

    public SentenceNode(AbstractNode direction, AbstractNode action, AbstractNode distance) {
        this.direction = direction;
        this.action = action;
        this.distance = distance;
    }

    /**
     * 简单句子解释操作
     * @return
     */
    @Override
    public String interpret() {
        return direction.interpret() + action.interpret() + distance.interpret();
    }
}
